﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.Util;

namespace Authentication.Model.Model
{
    public partial class ApplicationObject
    {
        public ApplicationObject()
        {
            this.ObjectSubstitutions = new HashSet<ObjectSubstitution>();
            this.AccountRules = new HashSet<ApplicationAccountRule>();
            this.GroupRules = new HashSet<ApplicationGroupRule>();
        }
        /// <summary>
        /// Relateion Object & ObjectSubs
        /// </summary>
        public ICollection<ObjectSubstitution> ObjectSubstitutions { get; set; }


        /// <summary>
        /// Relateion Object & Account_Object_Roles
        /// </summary>
        public ICollection<ApplicationAccountRule> AccountRules { get; set; }

        /// <summary>
        /// Relateion Object & Group_Object_Roles
        /// </summary>
        public ICollection<ApplicationGroupRule> GroupRules { get; set; }

        public string ApplicationKey { get; set; }

        [NotMapped]
        public Guid GuidKey { get { return new Guid(this.ApplicationKey); } }

        [NotMapped]
        public bool IsActive { get { return Active.IsYes(); } }
    }
}
